<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Event</title>
  <style>
    * {
      margin: 0;
      padding: 0;
    }
    .box {
      width: 300px;
      height: 300px;
      background-color: red;
      margin: 100px auto;
    }
    .box1 {
      width: 200px;
      height: 200px;
      background-color: yellow;
    }
    .box2 {
      width: 100px;
      height: 100px;
      background-color: green;
    }
  </style>
</head>
<body>
  <div class="box">
    <div class="box1">
      <div class="box2"></div>
    </div>
  </div>
  <script>
    const box = document.getElementsByClassName('box')[0]
    const box1 = document.getElementsByClassName('box1')[0]
    const box2 = document.getElementsByClassName('box2')[0]

    // box.addEventListener('click', (event) => {
    //   console.log(event.currentTarget)
    //   console.log(event.target)
    // },true)
    // box1.addEventListener('click', (event) => {
    //   console.log(event.currentTarget)
    //   // console.log(event.target)
    //    console.log(event.target)
    // },true)
    // box2.addEventListener('click', (event) => {
    //   console.log(event.currentTarget)
    //   // console.log(event.target)
    //   // event.preventDefault()
    //   event.stopPropagation()
    // },true)

    // mouseenter mouseleave 不支持事件冒泡
    // box.addEventListener('mouseout',() => {
    //   console.log('leave')
    // })
    // box.addEventListener('mouseover', () => {
    //   console.log('enter')
    // })
    // box.addEventListener('mouseup', () => {
    //   console.log('up')
    // })
    box.addEventListener('click', (e) => {
      console.log(e)
    })
  </script>
</body>
</html>